<?php
require_once '../sub/init.php';
header("Cache-control: private");
require_once 'chkUadm.php';
if(!in_array('u_endtime',$QXARR))exit(noauth());
require_once ZEAI.'cache/udata.php';?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="<?php echo HOST;?>/res/www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<link href="css/main.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css">
</head>
<style>
.box{min-width:1000px;padding:0}
.RCWsex{display:inline-block}
.RCWsex li{width:50px}
</style>
<body<?php echo (ifint($uid))?' class="body"':'';?>>
<div class="box">
	<?php if (!ifint($uid)){?>
	<div class="boxL">
        <?php if(CRMQX('tip_list')){?><a href="tip_list.php?uid=<?php echo $uid;?>">消息通知</a><?php }?>
        <?php if(CRMQX('chat_list')){?><a href="chat_list.php?uid=<?php echo $uid;?>">私信聊天</a><?php }?>
        <?php if(CRMQX('view_list')){?><a href="view_list.php?uid=<?php echo $uid;?>">谁看过我</a><?php }?>
        <?php if(CRMQX('gz_list')){?><a href="gz_list.php?uid=<?php echo $uid;?>">用户关注</a><?php }?>
        <?php if(CRMQX('hh_list')){?><a href="hh_list.php?uid=<?php echo $uid;?>">用户互换</a><?php }?>
        <?php if(CRMQX('u_bbs')){?><a href="u_bbs.php?uid=<?php echo $uid;?>">用户评价</a><?php }?>
        <?php if(CRMQX('u_endtime')){?><a href="u_endtime.php?uid=<?php echo $uid;?>" class='ed'>最新登录</a><?php }?>
	</div>
	<div class="boxR">
        <div class="topsearch">
            <form name="ZEAI_CN__form1" method="get" action="<?php echo SELF; ?>">
                <input name="Skey" type="text" id="Skey" size="40" class="input size2" value="<?php echo $Skey;?>" placeholder="按UID/用户名/手机/微信号/姓名/昵称/OPENID/备注" title="也可以搜索OPENDID" style="width:320px">
                <ul id="sex_box" name="sex_box" class="size2 RCW RCWsex">
                <?php 
			  $sexARR = json_decode($_UDATA['sex'],true);
                foreach ($sexARR as $V) {?>
                <li><input type="radio" class="radioskin" id="sex<?php echo $V['i'];?>" name="sex" value="<?php echo $V['i'];?>"<?php echo ($sex == $V['i'])?' checked':''; ?>><label for="sex<?php echo $V['i'];?>" class="radioskin-label"><i class="i1"></i><b><?php echo $V['v'];?></b></label></li>
                <?php }?>
                </ul>
              <input type="hidden" name="p" value="<?php echo $p;?>" /><button type="submit" class="btn size2"><i class="ico">&#xe6c4;</i> 搜索</button>
            </form>
            <div class="rbox">

            </div>
        </div>
	<?php }?>
        <!---->
        <?php
        $SQL = "";
        $Skey = trimhtml($Skey);
		if (!empty($Skey)){
			if(ifmob($Skey)){
				$SQL .= " AND (mob='".$Skey."' OR mob2='".$Skey."') ";
			}elseif(ifint($Skey)){
				$SQL .= " AND id=".$Skey;	
			}elseif(str_len($Skey)>20){	
				$SQL .= " AND openid='$Skey'";	
			}else{
				$SQL .= " AND (( truename LIKE '%".$Skey."%' ) OR ( uname LIKE '%".$Skey."%' ) OR ( nickname LIKE '%".$Skey."%' ) OR ( nickname LIKE '%".urlencode($Skey)."%' ) OR ( bz LIKE '%".$Skey."%' ) OR ( weixin LIKE '%".$Skey."%' )  ) ";
			}
		}
		if(ifint($sex))$SQL .= " AND sex=".$sex;
        if (ifint($uid))$SQL = " AND (id=$uid) ";
		if($session_kind == 'crm')$SQL .= " AND admid=".$session_uid;//认领红娘名下
        $SORT = " ORDER BY endtime DESC,refresh_time DESC,id DESC";
        $rt = $db->query("SELECT id,sex,grade,uname,nickname,photo_s,regtime,regip,endtime,endip,click FROM ".__TBL_USER__." WHERE flag=1 ".$SQL.$SORT."  LIMIT ".$_ADM['admLimit']);
        $total = $db->num_rows($rt);
        if ($total <= 0 ) {
            echo "<div class='nodataico'><i></i>暂无内容符合";
            if (!ifint($uid))echo"<br><a class='aQINGed' href='javascript:history.back(-1)'>返回上一步</a>";
            echo "</div>";
        } else {
            $page_skin=2;$pagemode=3;$pagesize=$_ADM['admPageSize'];require_once ZEAI.'sub/page.php';
        ?>
        <form id="www_zeai_cn_FORM" method="get" action="<?php echo SELF; ?>">
        <table class="tablelist">
        <tr>
        <th width="20"><input type="checkbox" id="checkboxall1" class="checkskin checkboxall"><label for="checkboxall1" class="checkskin-label"><i class="i1"></i></label></th>
        <th width="11"></th>
        <th width="50">头像</th>
        <th width="180" align="left">UID/昵称</th>
        <th width="140" align="left">最新登录时间/IP</th>
        <th width="20" align="left">&nbsp;</th>
        <th width="200" align="left">注册时间/IP</th>
        <th width="66">人气</th>
        <th>&nbsp;</th>
        </tr>
        <?php
        for($i=1;$i<=$pagesize;$i++) {
            $rows = $db->fetch_array($rt,'name');
            if(!$rows) break;
            $id = $rows['id'];$uidd = $rows['uid'];
            $uname = strip_tags($rows['uname']);
            $uname = str_replace($Skey,"<font color=red><b>".$Skey."</b></font>",$uname);
            $nickname = dataIO($rows['nickname'],'out');
            $nickname = str_replace($Skey,"<font color=red><b>".$Skey."</b></font>",$nickname);
            $sex       = $rows['sex'];
            $grade     = $rows['grade'];
            if(empty($rows['nickname']))$nickname = $uname;
            $regtime = YmdHis($rows['regtime']);
            $endtime = YmdHis($rows['endtime']);
            $regip   = $rows['regip'];
            $endip   = $rows['endip'];
            $click   = $rows['click'];
            $photo_s = $rows['photo_s'];
			$photo_s_url = (!empty($photo_s))?UP.$photo_s:RES.'photo_s'.$sex.'.png';
			$title2 = (!empty($nickname))?urlencode(trimhtml($nickname)).'／'.$id:$id;
        ?>
        <tr id="tr<?php echo $id;?>">
            <td width="20" height="40"><input type="checkbox" name="list[]" value="<?php echo $id; ?>" uid="<?php echo $uid; ?>" id="id<?php echo $id; ?>" class="checkskin"><label for="id<?php echo $id; ?>" class="checkskin-label"><i class="i1"></i></label>
            </td>
          <td width="11" class="C999">&nbsp;</td>
          <td width="50" class="C999"><a href="javascript:;" photo_s_url="<?php echo $photo_s_url;?>" class="photo_s" uid="<?php echo $id;?>" title2="<?php echo $title2;?>" title="浏览个人主页"><img src="<?php echo $photo_s_url;?>" class="photo_s40 yuan"></a></td>
            <td width="180" align="left">
    <a href="javascript:;" uid="<?php echo $id;?>" title2="<?php echo $title2;?>" class="photo_s" photo_s_url="<?php echo $photo_s_url;?>">
    <?php echo uicon($sex.$grade) ?><?php echo '<font>'.$id.'</font></br>';?></a>
    <font class="uleft">
    <?php
    //if(!empty($rows['mob']))echo $mob."</br>";
    echo $nickname;
    ?>
    </font>

            </td>
          <td width="140" align="left" class="lineH150 C666"><i class="ico">&#xe634;</i> <?php echo $endtime;?><div class="C999"><?php echo $endip;?></div></td>
            <td width="20" align="left">&nbsp;</td>
          <td width="140" align="left" class="lineH150 C666"><i class="ico">&#xe634;</i> <?php echo $regtime;?><div class="C999"><?php echo $regip;?></div></td>
          <td width="66" align="left" class="S12"><?php echo $click; ?></td>
          <td>&nbsp;</td>
          </tr>
        <?php } ?>
        </table>
        </form>
        <?php }?>
		<!---->
	<?php if (!ifint($uid)){?></div><?php }?>
    <div class="clear"></div>
</div>

<?php if ($total > 0 ) {?>
<div class="listbottombox">
	<input type="checkbox" id="checkboxall2" class="checkskin checkboxall"><label for="checkboxall2" class="checkskin-label"><i class="i1"></i></label>　
    <button type="button" id="btnsend" value="" class="btn size2 disabled action" onClick="sendTipFn(this);"><i class="ico">&#xe676;</i> 发消息</button>
    <input type="hidden" name="submitok" id="submitok" value="" />
	<?php if ($total > $pagesize)echo '<div class="pagebox FR">'.$pagelist.'</div>'; ?>
</div>

<script>
var bg = '<?php echo $_Style['list_bg']; ?>',overbg = '<?php echo $_Style['list_overbg']; ?>',selectbg = '<?php echo $_Style['list_selectbg']; ?>';
zeai.listEach('.photo_s',function(obj){
	obj.onclick = function(){
		var uid = parseInt(obj.getAttribute("uid"));
		var title2 = obj.getAttribute("title2");
		var photo_s_url = decodeURIComponent(obj.getAttribute("photo_s_url"));
		crm_homepage({uid:uid,title2:title2,photo_s_url:photo_s_url});
	}
});
</script>
<script src="js/zeai_tablelist.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<?php }?>
<?php require_once 'bottomadm.php';?>